<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8"/>
	<title>分配权限 - bjyadmin</title>
	<link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap/dist/css/bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/animate.css/animate.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/font-awesome/css/font-awesome.min.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/simple-line-icons/css/simple-line-icons.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap-editable/css/bootstrap-editable.min.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/app/css/font.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/app/css/app.css" type="text/css" />
</head>
<body>
<div class="wrapper-md">
	<div class="panel panel-default">
	    <div class="panel-heading">
	       <a href="{:U('Admin/Index/welcome')}"><i class="fa fa-home"></i>&nbsp;首页&nbsp;&gt;&nbsp;&nbsp;<a href="{:U('Admin/Rule/group')}">用户组列表</a>&nbsp;&gt;&nbsp;&nbsp;分配权限
	    </div>
		<div class="table-responsive">
	        <form class="form-inline" action="" method="post">
				<input type="hidden" name="id" value="{$group_data['id']}">
				<table class="table table-bordered">
					<foreach name="rule_data" item="v">
						<empty name="v['_data']">
							<tr class="b-group">
								<th width="10%">
									<label class="i-checks">
	                                    <input type="checkbox" name="rule_ids[]" value="{$v['id']}" <if condition="in_array($v['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)" >
	                                    <i></i>{$c['title']}
									</label>
								</th>
								<td></td>
							</tr>
						<else />
							<tr class="b-group">
								<th width="10%">
									<label class="i-checks">
	                                    <input type="checkbox" name="rule_ids[]" value="{$v['id']}" <if condition="in_array($v['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)" >
	                                    <i></i>{$v['title']} 
	                                </label>
								</th>
								<td class="b-child">
									<foreach name="v['_data']" item="n">
										<table class="table table-bordered m-xs">
											<tr class="b-group">
												<th width="10%">
													<label class="i-checks">
					                                    <input type="checkbox" name="rule_ids[]" value="{$n['id']}" <if condition="in_array($n['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)" >
					                                    <i></i>{$n['title']} 
					                                </label>
												</th>
												<td>
													<notempty name="n['_data']">
														<volist name="n['_data']" id="c">
															<label class="i-checks">
							                                    &emsp;<input type="checkbox" name="rule_ids[]" value="{$c['id']}" <if condition="in_array($c['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)" >
							                                    <i></i>{$c['title']} 
							                                </label>
														</volist>
													</notempty>
												</td>
											</tr>
										</table>
									</foreach>
								</td>
							</tr>
						</empty>
					</foreach>
					<tr>
						<td></td>
						<td>
							<input class="btn btn-success" type="submit" value="提交">
						</td>
					</tr>
				</table>
			</form>
	    </div>
  </div>
</div>


<script src="__ADMIN_STATICS__/jquery/jquery.min.js"></script>
<script src="__ADMIN_STATICS__/bootstrap/dist/js/bootstrap.js"></script>
<script>
function checkAll(obj){
    $(obj).parents('.b-group').eq(0).find("input[type='checkbox']").prop('checked', $(obj).prop('checked'));
}
</script>
</body>
</html>
